import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '../views/userLogin.vue'
import User from '../views/userManage.vue'
import Role from '../views/roleManage.vue'
import SystemManage  from '../views/systemManage.vue'
// 定义 routersList 将路径分离出来
export const routersList = [
  // {
  //   path: '/login',
  //   name: 'login',
  //   component: Login,
  //   title: '登录'
  // },
  // {
  //   path: '/user',
  //   name: 'user',
  //   component: User,
  //   title: '用户管理'
  // },
  // {
  //   path: '/role',
  //   name: 'role',
  //   component: Role,
  //   title: '角色管理'
  // },
  {
    path: '/system',
    name: 'system',
    component: SystemManage,
    title: '系统管理',
    children: [
      {
        name: 'login',
        path: 'login',
        component: Login,
        title: '用户登录',
      },
      {
        name: 'user',
        path: 'user',
        component: User,
        title: '用户管理',
      },
      {
        name: 'role',
        path: 'role',
        component: Role,
        title: '角色管理',
      },
    ],
  },
]

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),  // history模式
  history: createWebHashHistory(import.meta.env.BASE_URL), // hash 模式
  routes: routersList,
})

export default router
